package com.card.service;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.card.dao.CardDao;
import com.card.model.Card;

@Service
public class CardService {
	
	@Autowired
	private CardDao cardDao;

	public JSONArray getCardInfo(String username, String password) {
		System.out.println("Service"+username+password);
//		Card c=cardDao.getCard(username,password);
//		JSONObject card = new JSONObject();
//		card.put("username", c.getUsername());
//		card.put("password", c.getPassword());
//		card.put("cash", c.getCash());
//		card.put("account1", c.getAccount1());
//		card.put("tradedate", c.getTradedate());
//		card.put("tradeplace", c.getTradeplace());
//		card.put("tradebrief", c.getTradebrief());
//		card.put("tradeamount", c.getTradeamount());
	//	System.out.println("Service"+cardsArray);
	//	return card;
		return cardDao.getCard(username,password);
	}
	
	public JSONArray sgetCompanyInfo(String comname, String comarea,String comtype) {
		System.out.println("Service"+comname+comarea+comtype);

		return cardDao.sgetCompany(comname,comarea,comtype);
	}
	
	public JSONArray getnearCompanyInfo() {
	//	System.out.println("Service"+comname+comarea+comtype);

		return cardDao.getnearCompany();
	}
	
	public JSONArray gethotCompanyInfo() {
		//	System.out.println("Service"+comname+comarea+comtype);

			return cardDao.gethotCompany();
		}
	
	public JSONArray getNewcardInfo(String username) {
		System.out.println("Service"+username);

		return cardDao.getNewcard(username);
	}
	
	public JSONArray getYctcardInfo(String username) {
		System.out.println("Service"+username);

		return cardDao.getYctcard(username);
	}
	
	public JSONArray getServiceInfo(String servname, String servarea,String servtype) {
	//	System.out.println("Service"+comname+comarea+comtype);

		return cardDao.getService(servname,servarea,servtype);
	}
	
	public JSONArray getnearServiceInfo() {
	//	System.out.println("Service"+comname+comarea+comtype);
		System.out.println("service");
		return cardDao.getnearService();
	}

}
